<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let res = location.search.slice(1);//截取字符串
        let arr = res.split('&');//以&分割字符串，返回数组
        console.log(res,arr);
        let obj = {};
        arr.forEach((item, index) => {
            let line = item.split('=');
            console.log(line);
            obj[line[0]] = line[1];
        })
        console.log(obj);

    </script>
</body>
</html>